import React, { PureComponent } from 'react';
import { connect } from 'react-redux';
import { fetchHomeMultidataAction } from '../store(拆分)/home'

//借助redux-thunk增强store，统一在action中进行异步网络请求，获取数据
class Rank extends PureComponent {

  componentDidMount() {
    this.props.fetchHomeMultidata();
  }

  render() { 
    return ( 
      <div>
        <h2>Rank</h2>
        <p>使用redux-thunk请求数据</p>
      </div>
     );
  }
}
 

const mapDispatchToProps = (dispatch) => {
  return {
    fetchHomeMultidata() {
      dispatch(fetchHomeMultidataAction())
    }
  }
}

export default connect(null, mapDispatchToProps)(Rank);
